#include "lessthan10Pattern.h"
#include "toolkit.h"
#include <wx/statusbr.h>
#include <wx/msgdlg.h>
#include "global.h"

lessthan10Pattern::lessthan10Pattern()
{
 AICaption=wxT("lessthan10Pattern ") ;
 sleeptime =500;
 dBall=0;
}
lessthan10Pattern::lessthan10Pattern(wxWindow * msgwin)
{
    _win=msgwin;
}

void lessthan10Pattern::setMsgWin(wxWindow * msgwin)
{
    _win=msgwin;
}

lessthan10Pattern::~lessthan10Pattern()
{
    //dtor
}

void *lessthan10Pattern::Entry()
{
    wxString text;
    text.Printf(getName()+_(" %lx 开始 (priority = %u).\n"),
                GetId(), GetPriority());
    long count=0;

//query db
  DoubleBall* db= new DoubleBall();

 char SQL[1024];

 while(count<40)
 {
   count++;
   sprintf(SQL,"select * from _dbhistory limit %d ",count);
   db->query(SQL);
   if(db->records==NULL)
    {
        BFrame->SetStatusText(_T("没有任何记录"));
    }
     BFrame->SetStatusText(text+_(" ")+wxString::Format(wxT("  记录:%d"),db->nrow));
     Sleep(sleeptime);
 }
     delete db;

}
//logic code in here
void lessthan10Pattern::OnExit(){};

wxArrayString lessthan10Pattern::tellMe(wxString term)
{
    wxArrayString result;
    return  result;
}
IMPLEMENT_DYNAMIC_CLASS(lessthan10Pattern, AIBase);
